<template>
  <div class="emr-content-module module-chiefComplaint">
    <h3 id="chiefComplaint" @click="showMsg">
      主诉
      <el-popover placement="right" title="主诉" :width="300" trigger="hover">
        <div>
          1.
          孩子主要有什么不舒服？除了咳嗽，有无气喘？气喘时会从胸部发出“嘿嘿”或“嘶嘶”的高调声音，从鼻子或咽喉部发出的呼吸嘈音通常不是喘音。
        </div>
        <div>
          2.
          咳嗽/咳喘已经有多长时间？现在有咳嗽/咳喘吗？这一次发作多久了？除了这1次，以前有无反复咳嗽/咳喘情况？反反复复有多长时间啦？
        </div>
        <div>3. 以前看病时有无医生说听到孩子有喘音？</div>
        <template #reference>
          <svg-icon icon-class="question" />
        </template>
      </el-popover>
    </h3>
    <div class="content-wrapper" :class="{ locked: d.disabled }">
      <span>反复</span>
      <el-checkbox
        size="medium"
        :disabled="d.disabled"
        v-model="d.chiefComplaint.cough"
      >
        咳嗽
      </el-checkbox>

      <el-checkbox
        size="medium"
        :disabled="d.disabled"
        v-model="d.chiefComplaint.wheezing"
      >
        伴喘息发作
      </el-checkbox>

      <el-select
        clearable
        size="medium"
        v-model="d.chiefComplaint.years"
        :disabled="d.disabled"
        style="width: 4rem"
      >
        <el-option
          v-for="(item, idx) in YEARS"
          :value="item"
          :disabled="d.disabled"
          :key="'module-chiefComplaint_YEARS_KEY_' + idx"
        >
          {{ item }}
        </el-option>
      </el-select>
      年
      <el-select
        clearable
        size="medium"
        v-model="d.chiefComplaint.months"
        :disabled="d.disabled"
        placeholder=""
        style="width: 4rem"
      >
        <el-option
          v-for="(item, idx) in MONTHS"
          :value="item"
          :key="'module-chiefComplaint_MONTHS_KEY_' + idx"
        >
          {{ item }}
        </el-option>
      </el-select>
      月
      <el-select
        clearable
        size="medium"
        v-model="d.chiefComplaint.days"
        :disabled="d.disabled"
        placeholder=""
        style="width: 4rem"
      >
        <el-option
          v-for="(item, idx) in DAYS"
          :value="item"
          :key="'module-chiefComplaint_DAYS_KEY_' + idx"
        >
          {{ item }}
        </el-option>
      </el-select>
      天 ，再发
      <el-select
        clearable
        size="medium"
        v-model="d.chiefComplaint.reMonths"
        :disabled="d.disabled"
        placeholder=""
        style="width: 4rem"
      >
        <el-option
          v-for="(item, idx) in MONTHS"
          :value="item"
          :key="'YEARS_KEY_' + idx"
        >
          {{ item }}
        </el-option>
      </el-select>
      月
      <el-select
        clearable
        size="medium"
        v-model="d.chiefComplaint.reDays"
        @change="relativeTo('reMonths')"
        :disabled="d.disabled"
        placeholder=""
        style="width: 4rem"
      >
        <el-option
          v-for="(item, idx) in DAYS"
          :value="item"
          :key="'YEARS_KEY_' + idx"
        >
          {{ item }}
        </el-option>
      </el-select>
      天.
      <el-input
        size="medium"
        type="textarea"
        :disabled="d.disabled"
        placeholder="补充内容,限制100个字符以内 "
        :maxlength="100"
        :autosize="{ minRows: 1, maxRows: 4 }"
        v-model="d.chiefComplaint.others"
        style="margin-top: 0.5rem"
      ></el-input>
    </div>
  </div>
</template>
<script>
  import { reactive, inject } from 'vue'
  import { initChiefComplaint } from './initTools.js'
  export default {
    setup() {
      const d = reactive({
        chiefComplaint: initChiefComplaint(),
        disabled: false,
        others: null,
      })
      const showMsg = function () {}
      const relativeTo = function (val) {
        console.log('val =' + val)
      }
      const YEARS = inject('YEARS')
      const MONTHS = inject('MONTHS')
      const DAYS = inject('DAYS')
      const content =
        // eslint-disable-next-line max-len
        '1. 孩子主要有什么不舒服？除了咳嗽，有无气喘？气喘时会从胸部发出“嘿嘿”或“嘶嘶”的高调声音，从鼻子或咽喉部发出的呼吸嘈音通常不是喘音。\\/n 2. 咳嗽/咳喘已经有多长时间？现在有咳嗽/咳喘吗？这一次发作多久了？除了这1次，以前有无反复咳嗽/咳喘情况？反反复复有多长时间啦？3. 以前看病时有无医生说听到孩子有喘音？'
      const getData = function () {
        return d.chiefComplaint
      }
      return {
        showMsg,
        d,
        relativeTo,
        YEARS,
        MONTHS,
        DAYS,
        content,
        getData,
      }
    },
  }
</script>
<style lang="scss" scoped>
  @import '@/styles/emr.scss';
</style>
